const { SyncHook } = require("tapable");

class HYCompiler {
  constructor() {
    this.hooks = {
      syncHook: new SyncHook(["name", "age"]),
    };

    this.hooks.syncHook.tap("event1", (name, age) => {
      console.log("event1事件执行了", name, age);
    });

    this.hooks.syncHook.tap("event2", (name, age) => {
      console.log("event1事件执行了", name, age);
    });
  }
}

setTimeout(() => {
  const compiler = new HYCompiler();
  compiler.hooks.syncHook.call("why", 23);
}, 2000);
